import Ember from 'ember';
import BaseBusiness from '../base-business';

export default BaseBusiness.extend({
  global_dataLoader: Ember.inject.service('data-loader'),
  model(){
    return{};
  },
  setupController(controller, model){
    this._super(controller, model);
    controller.set('confList',null);
    let rangeArr = ['drugDay','nursingOvertime','nursingAdvancetime','drugOvertime','drugAdvancetime','callOvertime'];
    let dom = $('#datatable1_wrapper');
    if(dom){
      App.lookup('controller:business.mainpage').showTableLoading(dom);
    }
    this.store.query('conf',{}).then(function(confList){
      let list = new Ember.A();
      confList.forEach(function(conf){
        let code = conf.get("code");
        if(rangeArr.indexOf(code) > -1){
          if(code == 'drugDay'){
            conf.set('unit','天');
          } else {
            conf.set('unit','分钟');
          }
          list.pushObject(conf);
        }
      });
      controller.set('confList',list);
      $('#datatable1_wrapper .pageLoading').remove();
    });
  }
});
